import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-05-03
 * Time: 9:48
 */
class Person {

}
class Student extends Person {

}
class AAA {

}
class MyArrayList<T extends Person> {

    public int usedSize;
    public T[] arr;

    public MyArrayList() {
        this.arr = (T[])new Object[10];
    }

    public void add(T val) {
        arr[usedSize] = val;
        usedSize++;
    }
}

public class Test {

    public static void main(String[] args) {
        MyArrayList<Student> myArrayList1 = new MyArrayList<>();
        MyArrayList<Person> myArrayList2 = new MyArrayList<>();

        //MyArrayList<AAA> myArrayList3 = new MyArrayList<>();

        /*//存放String类型
        MyArrayList<String> myArrayList1 = new MyArrayList<>();
        myArrayList1.add("abc");
        myArrayList1.add("xyz");

        //存放int类型
        MyArrayList<Integer> myArrayList2 = new MyArrayList<>();
        myArrayList2.add(1);
        myArrayList2.add(2);*/
    }
}
